package ru.tulupov.toyfactory.model;

public class TV implements Playable {
	private Channel channel;
	private long timestamp;

	public TV(Channel channel, long timestamp) {
		this.channel = channel;
		this.timestamp = timestamp;
	}

	@Override
	public void play() {

	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		if (obj == this) {
			return true;
		}

		if (obj instanceof TV) {
			TV tv = (TV) obj;

			return (channel == tv.channel) && (timestamp == tv.timestamp);
		}

		return false;
	}

	@Override
	public int hashCode() {
		return 17 * channel.hashCode() + 31 * (int) timestamp;
	}

	@Override
	public String toString() {

		return String.format("TV[%s, %d]", channel, timestamp);
	}
}
